<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" xml:lang="en" lang="en">
<head>
    <title>My Facelets Page</title>
    <meta http-equiv="keywords" content="enter,your,keywords,here"/>
    <meta http-equiv="description"
          content="A short description of this page."/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>

    <!--<link rel="stylesheet" type="text/css" href="styles.css">-->
</head>
<body>
<ui:composition template="UserCenterGeneral.xhtml">
    <ui:define name="ucontent">
        <p:dialog id="viewMMDialog" header="查看消息" widgetVar="viewMMDialog">
            <p:outputPanel autoUpdate="true">
                <h:panelGrid columns="2" styleClass="generalInfo" style="width:300px;min-height: 100px;">
                    <h:outputText value="标题："/>
                    <h:outputText value="#{clientListMsg.mm.title}"/>
                    <h:outputText value="接收者："/>
                    <h:outputText value="#{clientListMsg.mm.receiver.username}"/>
                    <h:outputText value="内容："/>
                    <h:outputText value="#{clientListMsg.mm.content}"/>
                    <h:outputText value="时间："/>
                    <h:outputText value="#{clientListMsg.mm.genTime}">
                        <f:convertDateTime pattern="yyyy-MM-dd HH:mm" timeZone="GMT+8"/>
                    </h:outputText>
                </h:panelGrid>
            </p:outputPanel>
            <p:separator/>
            <p:commandButton value="关闭" onclick="viewMMDialog.hide();" type="button"/>
        </p:dialog>

        <div style="text-align: left; margin: 10px 0px 0px 0px; width: 98%;">
            <div>
                <h:panelGrid columns="2" style="width:100%">
                    <h:outputText id="outputText1" styleClass="mark"
                                  value="－消息管理－"/>
                </h:panelGrid>

            </div>
            <p:separator></p:separator>

            <div>

                <p:tabView>
                    <p:tab title="收件箱">
                        <p:dataTable id="dataTable1" styleClass="generalInfo" style="width:100%"
                                     value="#{clientListMsg.incomes}" var="Case" rowIndexVar="r" emptyMessage="没有消息">
                            <p:column id="num">
                                <h:outputText style="height: 5%"
                                              value="#{r+1}"/>
                                <f:facet name="header">
                                    <h:outputText id="outputTextnum" value="序号"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputText style="height: 5%" value="#{Case.title}"/>
                                <f:facet name="header">
                                    <h:outputText id="outputText3" value="标题"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputText style="height: 5%" value="#{Case.sender.username}">
                                </h:outputText>
                                <f:facet name="header">
                                    <h:outputText value="发件人"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputText style="height: 5%;color:red;font-weight: bold;" value="未读"
                                              rendered="#{!Case.readed}"/>
                                <h:outputText style="height: 5%;color:green;" value="已读" rendered="#{Case.readed}"/>
                                <f:facet name="header">
                                    <h:outputText value="状态"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputText style="height: 5%" value="#{Case.genTime}">
                                    <f:convertDateTime pattern="yyyy-MM-dd HH:mm" timeZone="GMT+8"/>
                                </h:outputText>
                                <f:facet name="header">
                                    <h:outputText value="时间"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputLink
                                        value="ClientViewMessage.jspx?mid=#{Case.id}&amp;id=#{clientSession.usr.id}"
                                        styleClass="operation">
                                    <h:outputText value="查看/回复"></h:outputText>
                                </h:outputLink>
                                <f:facet name="header">
                                    <h:outputText style="height: 5%" value="查看/回复"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <p:commandLink action="#{clientListMsg.receiverMarkdel(Case.id)}" value="删除"
                                               styleClass="operation" update="dataTable1">
                                </p:commandLink>
                                <f:facet name="header">
                                    <h:outputText style="height: 5%" value="删除"/>
                                </f:facet>
                            </p:column>
                        </p:dataTable>

                    </p:tab>
                    <p:tab title="发件箱">
                        <p:dataTable id="dataTable2" styleClass="generalInfo" style="width:100%" rowIndexVar="r"
                                     value="#{clientListMsg.outgos}" var="Case" emptyMessage="没有消息">
                            <p:column>
                                <h:outputText style="height: 5%"
                                              value="#{r+1}"/>
                                <f:facet name="header">
                                    <h:outputText value="序号"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputText style="height: 5%" value="#{Case.title}"/>
                                <f:facet name="header">
                                    <h:outputText value="标题"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputText style="height: 5%" value="#{Case.receiver.username}">
                                </h:outputText>
                                <f:facet name="header">
                                    <h:outputText value="收件人"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <h:outputText style="height: 5%" value="#{Case.genTime}">
                                    <f:convertDateTime pattern="yyyy-MM-dd HH:mm" timeZone="GMT+8"/>
                                </h:outputText>
                                <f:facet name="header">
                                    <h:outputText value="发送时间"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <p:commandButton value="查看" action="#{clientListMsg.viewMM(Case.id)}"
                                                 onclick="viewMMDialog.show();"/>
                                <f:facet name="header">
                                    <h:outputText style="height: 5%" value="查看"/>
                                </f:facet>
                            </p:column>
                            <p:column>
                                <p:commandLink action="#{clientListMsg.senderMarkdel(Case.id)}" update="dataTable2"
                                               styleClass="operation"
                                               value="删除"/>
                                <f:facet name="header">
                                    <h:outputText style="height: 5%" value="删除"/>
                                </f:facet>
                            </p:column>
                        </p:dataTable>

                    </p:tab>

                </p:tabView>

                <p:separator></p:separator>
            </div>

        </div>

    </ui:define>
</ui:composition>
</body>
</html>
